package redis1

import (
	"context"
	"fmt"
	"github.com/go-redis/redis/v8"
)

var rdb *redis.Client
var ctx = context.Background()

func init() {
	fmt.Println(">>>>>>>>init")
	rdb = redis.NewClient(&redis.Options{
		//Username: "WangDirect",
		Addr: "localhost:6379",
		//Password: "123456",
		Password: "",
		DB: 0,
	})
	_ = rdb
}

func checkOutConnect(db *redis.Client) bool {
	if err := rdb.Ping(context.Background()).Err(); err != nil {
		return false
	}
	return true
}